package jwebtester.security.auth;

import infrastructure.Scopes;

import java.util.ArrayList;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.stereotype.Service;

/**
 * Represents the collection adapter around signle
 * {@link HibernateAuthenticationProvider} to provide constructor injection of
 * collection into {@link CustomAuthenticationManager}
 * 
 * @author iternovy
 * 
 */
@Service
@Scope(Scopes.Singleton)
public class AuthenticationProviders extends ArrayList<AuthenticationProvider> {
	private static final long serialVersionUID = 7385654331162055580L;
	private static final Logger LOG = LoggerFactory.getLogger(AuthenticationProviders.class);

	@Autowired
	public AuthenticationProviders(final HibernateAuthenticationProvider authProvider) {
		super();
		
		add(authProvider);
		LOG.info(String.format("Created %s", AuthenticationProviders.class));
	}
}
